package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.EasyUIResult;
import com.taotao.common.TaotaoResult;
import com.taotao.pojo.TbContent;
import com.taotao.service.ContentService;

@Controller
public class ContentController {
	@Autowired
	private ContentService contentService;
	
	@RequestMapping(value="/content/save",method=RequestMethod.POST)
	@ResponseBody
	public TaotaoResult savaContent(TbContent content){
		return contentService.insertContent(content);
	}
	
	@RequestMapping("/content/query/list")
	@ResponseBody
	public EasyUIResult getContentList(@RequestParam(defaultValue="1") int page,
			@RequestParam(defaultValue="20") int rows,@RequestParam(value="categoryId") long parentId){
		return contentService.getContentList(page, rows, parentId);
	}
}
